// import { ws } from '/src/front/ws/goldPrice.js';

const USD_XAU_PRICE = document.querySelector('#USD_XAU_PRICE');

goldpriceWS.onopen(() => {
    console.log('Start Get Price');
});

goldpriceWS.onmessage(price => {
    // Update Price Display.
    USD_XAU_PRICE.textContent = price;

    let PriceStack = getSSItem('PriceStack') || (new Array());

    // Update Price Stack.
    PriceStack.push({ price, c_time: Date.now() });
    if (PriceStack.length >= 100) {
        PriceStack.shift();
    }

    setSSItem('PriceStack', PriceStack);

})